<template>
	<view>
		<view class="view-block" v-for="(keys, index) in List">
			<view class="view-block-m">
				<view class="view-block-title">{{ keys.name }}</view>
				<view class="view-block-code" v-if="keys.code"><image :src="keys.code.iconPath" @tap="Code(keys.code)"></image></view>
			</view>
			<view class="view-block-m">
				<view class="view-block-icon" @click="Url(item)" v-for="(item, index) in keys.list">
					<view class="icon"><image :src="item.iconPath"></image></view>
					<view class="icon-title">{{ item.iconName }}</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {};
	},
	methods: {
		Code(key) {
			let seft=this;
			seft.POST('',{TenantId:9, OrderNo:'1',  OrderType:'gd',  PaymentPrice:'1',  auth_code:'auth_code'}).then(result=>{
				console.log('cost/wechatpay/getrun', result);
			})
			
			uni.scanCode({
				success(e) {
					console.log('scanCode', e);
					let auth_code=e.result;
					seft.POST('cost/wechatpay/getrun',{TenantId:9, OrderNo:'1',  OrderType:'gd',  PaymentPrice:'1',  auth_code:auth_code}).then(result=>{
						console.log('cost/wechatpay/getrun', result);
					})
					// uni.navigateTo({
					// 	url: key.url,
					// 	success: e => {
					// 		console.log('success', e);
					// 	},
					// 	fail: e => {
					// 		console.log('fail', e);
					// 	}
					// });
				}
			});
		},
		Url(item) {
			if (this.IsTabBar(item.url)) {
				uni.switchTab({
					url: item.url,
					success(e) {
						console.log(e);
					},
					fail(e) {
						console.log(e);
					}
				});
			} else {
				uni.navigateTo({
					url: item.url,
					animationType: 'pop-in',
					animationDuration: 1200,
					success(e) {
						console.log(e);
					},
					fail(e) {
						console.log(e);
					}
				});
			}
		}
	},
	props: ['List']
};
</script>
<style lang="scss">
.view-block {
	border-radius: 20upx;
	background: #fff;
	padding: 30upx;
	margin: 20upx 0;
}

.view-block-m {
	display: flex;
	flex-wrap: wrap;
}
.view-block-icon {
	width: 25%;
	margin: 30upx 0 10upx 0;
	text-align: center;
}
.view-block-icon > .icon > image {
	width: 100upx;
	height: 100upx;
}
.view-block-code > image {
	width: 50upx;
	height: 50upx;
	margin-left: 520upx;
	margin-top: -14upx;
}
</style>
